-
Notifications
You must be signed in to change notification settings - Fork 936
GH1149 one-to-one related object not loaded with stateless session #1620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH1149 one-to-one related object not loaded with stateless session #1620
Conversation
Signed-off-by: shoban <[email protected]>
Well, I was believing stateless sessions were not handling any kind of association, but the documentation only writes about collections. Granted, I have almost never used a stateless session. Does |
I believe so - the project that I was working on where I came across the 1:1 bug was with a hierarchy that had a many to one relationship that was being loaded correctly. |
No, no need. Ideally such a test should already exist somewhere in NHibernate tests, but I have not checked. |
I think the mappings and tests in NH1574 show retrieval of an object with a many-to-one association (SpecializedPrincipal). (StatelessTest.cs) |
</id> | ||
<property name="Name" /> | ||
|
||
<one-to-one name="Address" class="Address" property-ref="Company" cascade="all-delete-orphan"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May you add a test with an actual one-to-one
in db? I mean, a one-to-one
not using a property-ref
but with one entity pk being also the pk of the other entity (so a pk which is also a fk), both side mapped as one-to-one
with one side being constrained
. (PersonTrueO2O
with AddressTrueO2O
in NH3931 tests is an example of this.)
Unless this case is already tested in NHibernate.Test and working (meaning the issue report was not really precise).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, PR updated.
From my point of view the changes are correct and consistent with other places where associations are involved. |
Some notes of interest (which do not infirm this PR validity overall): I have checked the The But the constrained side fails like a Doing more checks, if the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work, LGTM.
return null; | ||
using (BeginProcess()) | ||
{ | ||
if (obj.IsProxy()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave it another thought. I think the true
branch is wrong/not possible/not needed.
Need async tests generation. |
Hi @seamus-hoban. Please drop the last commit and regenerate the async tests. To regenerate async tests: On windows:
On other platforms (mono):
|
Okay, will do sorry. Just pushing the reverted test file now as I've errors on the ShowBuildMenu options above. "unable to load one or more requested types' from Nant.NUnit2Tasks.dll. And "Msbuild failed when processing the file 'C:\Projects\nhibernate-core\src\NHibernate\NHibernate.csproj' with message: MSB0001: Internal MSBuild Error: Missing resource ''" |
The first error is usual (at least on my machine) and does not prevent the task to execute. I do not know about the second one, I have never seen it. Is your tooling up to date? I have pushed the async regeneration. |
Ok, I guess you have updated Visual Studio to its yesterday release, 15.6.3. With 15.6.2, it was still working. Now that I have updated it myself, it is broken.
@maca88, do you have the issue too? |
Thank you all! |
Are you speaking of this thread? I think it is another (maybe related) trouble, since it has been opened before 15.6.3 release and is about project creation. Otherwise could you link it? I have not seen building in VS is broken too, I use primarily Rider. And well, I can still build with VS, even after having fully cleaned obj/bin folders in case it was reusing some assets compiled through Rider. |
@hazzik, do you think this change is sufficiently mundane for going into 5.1.1? Or should it wait 5.2? |
@fredericDelaporte This thread: https://developercommunity.visualstudio.com/content/problem/218326/after-1563-publish-fails-due-to-error-projectasset.html |
This is kind-a a bug, so fine if it will be in 5.1.1. |
@fredericDelaporte Yes, it happened also to me after the upgrade. The solution was to upgrade the |
Fixes #1149
Here's my attempt to correct the above issue.
All unit tests run successfully, but I'm not sure that my change won't have other side-effects given that the fix is pretty much a crib from the stateful session, so any pointers would be most welcome.
Hopefully I've followed the contribution guidelines correctly.